package model;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "ChiTietTacGia_Sach")
public class ChiTietTacGia_Sach {
	private ChiTietTacGia_SachID chiTietTacGia_SachID;

	private Sach sach;
	private TacGia tacGia;

	// public ChiTietNXB_Sach(ChiTietNXB_SachID chiTietNXB_SachID) {
	// super();
	// this.chiTietNXB_SachID = chiTietNXB_SachID;
	// }

	public ChiTietTacGia_Sach(ChiTietTacGia_SachID chiTietTacGia_SachID,
			Sach sach, TacGia tacGia) {
		super();
		this.chiTietTacGia_SachID = chiTietTacGia_SachID;
		this.sach = sach;
		this.tacGia = tacGia;
	}

	public ChiTietTacGia_Sach() {
	}

	public ChiTietTacGia_Sach(ChiTietTacGia_SachID chiTietTacGia_SachID) {
		super();
		this.chiTietTacGia_SachID = chiTietTacGia_SachID;
	}

	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "ID_Sach", column = @Column(name = "ID_Sach", nullable = false)),
			@AttributeOverride(name = "ID_TacGia", column = @Column(name = "ID_TacGia", nullable = false)) })
	public ChiTietTacGia_SachID getChiTietTacGia_SachID() {
		return chiTietTacGia_SachID;
	}

	public void setChiTietTacGia_SachID(
			ChiTietTacGia_SachID chiTietTacGia_SachID) {
		this.chiTietTacGia_SachID = chiTietTacGia_SachID;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ID_Sach", nullable = false, insertable = false, updatable = false)
	public Sach getSach() {
		return sach;
	}

	public void setSach(Sach sach) {
		this.sach = sach;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ID_TacGia", nullable = false, insertable = false, updatable = false)
	public TacGia getTacGia() {
		return tacGia;
	}

	public void setTacGia(TacGia tacGia) {
		this.tacGia = tacGia;
	}

}
